<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px;">
<div style="margin: 10px 0px">
        <blockquote class="layui-elem-quote">
            说明：新建任务分组
        </blockquote>
    </div>
<form class="layui-form" action="" method="post" >
    <div class="layui-form-item">
        <label class="layui-form-label">分组名称</label>
        <div class="layui-input-inline" style="min-width: 200px;">
            <input type="text" name="group_name" id="group_name" lay-verify="required" autocomplete="off" placeholder="任务分组" class="layui-input" value="">
        </div>
        <div class="layui-form-mid layui-word-aux">*</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">分组说明</label>
        <div class="layui-input-inline" style="min-width: 400px;">
            <textarea name="description" id="description" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>

    </div>
    <input type="hidden" id="id" value="0">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="sub">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</div>
<script>
var $;
    layui.use(['form','element','layer','jquery'],function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        var $ = layui.jquery;
        var error_info = "{{.flash.error}}";
        if(error_info){
            layer.msg(error_info,{icon: 2,shade:0.3},function () {
                window.history.go(-1)
            })
            return;
        }
        form.on('submit(sub)', function(data){
            var form_data = $("form").serialize();
            $.post('{{urlfor "GroupController.AjaxSave"}}', form_data, function (out) {
                if (out.status == 0) {
                    layer.msg("操作成功",{icon: 1,shade:0.3,time:1000},function () {
                        window.history.go(-1)
                    })
                } else {
                    layer.msg(out.message)
                }
            }, "json");
            return false;
        });
      
      //但是，如果你的HTML是动态生成的，自动渲染就会失效
      //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
      form.render();
}); 
</script>